package com.logic.modular.act.cultivate;

import com.comment.util.message.ResponseResult;
import com.logic.comment.util.JwtUtils;
import com.logic.modular.act.cultivate.vo.CultivateVo;
import com.comment.pojo.domain.logic.domain.PlayerSkill;
import com.logic.modular.game.player.skill.PlayerSkillServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "玩家战法")
@Validated
@RestController
@AllArgsConstructor
@RequestMapping("/playerSkillAct")
public class PlayerSkillAction {
    private PlayerSkillServiceImpl playerSkillService;

    @ApiOperation("获取所有的战法")
    @PostMapping("/list")
    public ResponseResult<List<PlayerSkill>> list(@RequestHeader String token) {
        return ResponseResult.success(playerSkillService.list(JwtUtils.getPlayerId(token)));
    }

    @ApiOperation("升星")
    @PostMapping("/risingStar")
    public ResponseResult<?> risingStar(@RequestHeader String token , @RequestBody CultivateVo.PlayerSkillVo.RisingStar vo) {
        return ResponseResult.success(playerSkillService.risingStar(JwtUtils.getPlayerId(token),vo.getPlayerSkillId()));
    }
}
